#ifndef __ADCReader_Detect_H
#define __ADCReader_Detect_H
#include "CP_Monitor.h" 
#include "TEMP_Detect.h" 
#include "Chg_Voltage_Current.h" 
#include "BoardData.h"

// ADC参数
#define ADC_RTC                      RCM_APB2_PERIPH_ADC1
#define ADC_Id                       ADC1
#if ADC_num > 1
#define ADC2_RTC                     RCM_APB2_PERIPH_ADC2
#define ADC2_Id                      ADC2
#endif
#if ADC_num > 2
#define ADC3_RTC                     RCM_APB2_PERIPH_ADC3
#define ADC3_Id                      ADC3
#endif


// 温度ADC1-DMA：
#define DMA_ADC_RTC                  RCM_AHB_PERIPH_DMA1 
#define DMA_ADC_Chn                  DMA1_Channel1             // DMA 通道
#define DMA_Chann_IRQn               DMA1_Channel1_IRQn
#if ADC_num > 2 
#define DMA2_ADC3_RTC                RCM_AHB_PERIPH_DMA2 
#define DMA2_ADC3_Chn                DMA2_Channel5             // DMA 通道
#define DMA2_Chann_IRQn              DMA2_Channel4_5_IRQn
#endif


// 芯片内部温度通道
#define DMA_ADC_Core_TEMP_Chn         ADC_CHANNEL_16
#define DMA_ADC_Core_Vref_Chn         ADC_CHANNEL_17

// 采样参数：
#ifdef AT32F403AVGT7
#define ADC_SAMPLETIME_CYCLES         ADC_SAMPLETIME_71CYCLES5   //ADC_SAMPLETIME_239CYCLES5  ADC_SAMPLETIME_55CYCLES5  ADC_SAMPLETIME_71CYCLES5
#else
#define ADC_SAMPLETIME_CYCLES         ADC_SAMPLETIME_71CYCLES5
#endif


void ADC_Init(void);
#if ADC_num > 1
void ADC2_Init(void);
#endif
#if ADC_num > 2 && (defined TEMP2_ADC_Chn || defined TEMP3_ADC_Chn)
void ADC3_Init(void);
#endif

void DMA_Init(void);
#if ADC_num > 2 && (defined TEMP2_ADC_Chn || defined TEMP3_ADC_Chn)
void DMA2_ADC3_Init(void);
#endif

#endif

